//货柜管理-格子列表-配置文件
App.util.ns('Admin.Cabinet.Cell');
Admin.Cabinet.Cell.Conf = {
    columns: [
        {name: '位置', value: function(item){
              return item.row + ' 行，' + item.col + ' 列';
        }},
        {name: 'rfid', width: '220px',value: 'rfid'},
        {name: '编号', width: '60px',value: 'code'},
        {name: '商品', width: '290px', value: function(item){
            return item.goods ? item.goods.name : '未分配';
        }},
        {name: '价格', width: '100px', value: function(item){
            return item.price ? item.price.name : '未选择';
        }},
        {name: '状态', width: '80px', value: function(item){
            switch (item.status+'') {
                case '0':
                    return '空闲';
                case '1':
                    return '使用中';
                case '2':
                    return '故障';
            }
        }},
        {name: '创建日期', width: '80px', value: function(item){
            return App.util.formator.date(item.created_at);
        }}
    ],
    form: [
        {type: 'hidden', name: 'id'},
        [
            {type: 'static', name: 'row', title: '所属行', rule: {
                type: 'str',
                range: [0, 40]
            }},
            {type: 'static', name: 'col', title: '所属列', rule: {
                type: 'str',
                range: [0, 100]
            }}
        ],
        {type: 'input', name: 'rfid', title: 'rfid', rule: {
            type: 'str'
        }},
        {type: 'input', name: 'code', title: '编号', required: true, maxLength: 40, rule: {
            type: 'str',
            range: [1, 40]
        }},
        {type: 'chosen', name: 'price_id', title: '价格', required: true,
            items: App.models.get('prices-all'), 
            item_key: 'id', 
            item_name: 'name', 
            value_key: 'id',
            rule: {
                type: 'num',
                range: [0, 10]
            }
        }
    ]
};